#!/usr/bin/env python  
# encoding: utf-8   

""" 
@version: v1.0 
@author: null 
@software: PyCharm 
@file: test.py 
@time: 2017.3.19 20:51 
"""

import requests
import urllib

def func():
    pass


class Main():
    def __init__(self):
        pass


if __name__ == "__main__":
    response = requests.get(url='http://127.0.0.1:8765/?types=0&count=100&country=%E5%9B%BD%E5%86%85')
    data = response.json()
    print(data[0][0])
    print(data[0][1])
    print(str(data[0][0]) + ":" + str(data[0][1]))
    proxyhttp = urllib.request.ProxyHandler({'http': str(data[0][0]) + ":" + str(data[0][1])})
    opener = urllib.request.build_opener(proxyhttp)
    urllib.request.install_opener(opener)
    req = urllib.request.Request(url='http://www.baidu.com')
    urlhtml = urllib.request.urlopen(req)
    responsehtml = urlhtml.read()
    print(responsehtml)
    pass
